﻿using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;

namespace FwProject.Migrations
{
    public partial class ini201806 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<Guid>(
                name: "RestaurantInfoId",
                table: "RestaurantUserInfo",
                nullable: true,
                oldClrType: typeof(Guid));

            migrationBuilder.CreateIndex(
                name: "IX_RestaurantUserInfo_EmployeeRestaurantId",
                table: "RestaurantUserInfo",
                column: "EmployeeRestaurantId");

            migrationBuilder.CreateIndex(
                name: "IX_RestaurantUserInfo_RestaurantInfoId",
                table: "RestaurantUserInfo",
                column: "RestaurantInfoId");

            migrationBuilder.AddForeignKey(
                name: "FK_RestaurantUserInfo_AbpUsers_EmployeeRestaurantId",
                table: "RestaurantUserInfo",
                column: "EmployeeRestaurantId",
                principalTable: "AbpUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_RestaurantUserInfo_RestaurantInfo_RestaurantInfoId",
                table: "RestaurantUserInfo",
                column: "RestaurantInfoId",
                principalTable: "RestaurantInfo",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_RestaurantUserInfo_AbpUsers_EmployeeRestaurantId",
                table: "RestaurantUserInfo");

            migrationBuilder.DropForeignKey(
                name: "FK_RestaurantUserInfo_RestaurantInfo_RestaurantInfoId",
                table: "RestaurantUserInfo");

            migrationBuilder.DropIndex(
                name: "IX_RestaurantUserInfo_EmployeeRestaurantId",
                table: "RestaurantUserInfo");

            migrationBuilder.DropIndex(
                name: "IX_RestaurantUserInfo_RestaurantInfoId",
                table: "RestaurantUserInfo");

            migrationBuilder.AlterColumn<Guid>(
                name: "RestaurantInfoId",
                table: "RestaurantUserInfo",
                nullable: false,
                oldClrType: typeof(Guid),
                oldNullable: true);
        }
    }
}
